
server {
        listen 80;
        listen [::]:80;
        server_name  127.0.0.1 localhost;
		root   /home/vps/public_html;
        access_log /var/log/nginx/vps-access.log;
		error_log /var/log/nginx/vps-error.log error;

		listen 443 ssl; # managed by Certbot

    # RSA certificate
    ssl_certificate /etc/letsencrypt/live/vpn.aidan.my/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/vpn.aidan.my/privkey.pem; # managed by Certbot

    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

    # Redirect non-https traffic to https
    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot

  location / {
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

}
server {
    if ($host = localhost) {
        return 301 https://$host$request_uri;
    } # managed by Certbot